package com.springboot.springboot3.Mybatis.mapper;

import com.springboot.springboot3.bean.City;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

/**
 * @ClassName:
 * @author: CKC
 * @DateTime: 2021/1/29 9:54
 *
 * 注解方式
 */
@Mapper
public interface CityMapper {
    @Select("select * from city where id=#{id}")
    City getById(Long id);
    
    @Insert("insert into city(`name`,`state`,`country`) values (#{name} ,#{state} ,#{country})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    void inset(City city);
}
